package com.jiaai;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import java.util.Arrays;
import java.util.List;

@SpringBootApplication
@ComponentScan(value = {"com.jiaai"})
public class DemoApplication {

	public static void main(String[] args) {
		List<String> newArgs = Arrays.asList(args);
		System.out.println(newArgs);
//		newArgs.add("-Dcom.sun.management.jmxremote.port=12345");
//		newArgs.add("-Dcom.sun.management.jmxremote.ssl=false");
//		newArgs.add("-Dcom.sun.management.jmxremote.authenticate=false");
		SpringApplication.run(DemoApplication.class, newArgs.toArray(new String[newArgs.size()]));
	}




//	@Bean
//	public EmbeddedServletContainerFactory servletContainer() {
//		TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
//			@Override
//			protected void postProcessContext(Context context) {
//				SecurityConstraint constraint = new SecurityConstraint();
//				constraint.setUserConstraint("CONFIDENTIAL");
//				SecurityCollection collection = new SecurityCollection();
//				collection.addPattern("/");
//				constraint.addCollection(collection);
//				context.addConstraint(constraint);
//			}
//		};
//		tomcat.addAdditionalTomcatConnectors(httpConnector());
//		return tomcat;
//	}
//
//	@Bean
//	public Connector httpConnector() {
//		Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//		connector.setScheme("http");
//		//Connector监听的http的端口号
//		connector.setPort(80);
//		connector.setSecure(false);
//		//监听到http的端口号后转向到的https的端口号
//		connector.setRedirectPort(443);
//		return connector;
//	}



}
